<?php
namespace app\admin\controller;
use think\Controller;

use think\Db;
class Export extends Base{
	public function export_data(){
		$info_list = db('register')->select();		
        $this->assign([
            'export_consultant_list' => $info_list
        ]);
        header("Content-Type: application/vnd.ms-excel;charset=utf-8");
        header("Content-Disposition:filename=");
        header("Content-Disposition: attachment;filename=留资者信息.xls");
        header('Cache-Control: max-age=0');
        //die很重要，可以阻止页面渲染
        echo $this->fetch();
        die;
    }
    public function show_data(){
        $message_list = db("register")->order("addTime DESC")->paginate(20);
        $this->assign('message_list',$message_list);
        return view();
    }
}
?>